<?php
class db{
    function __construct($host,$user,$pwd){
        $this->conn = mysql_connect($host,$user,$pwd);
        mysql_select_db("php",$this->conn);
        
        mysql_query("SET NAMES UTF8");

    }
    
    function query($sql){
      return mysql_query($sql);
      
      }
    }
   

$db = new db("localhost",'root','root');
$res = $db->query("select * from user");

while($row = mysql_fetch_array($res)){
   $rows[] = $row;
}
//print_r($rows);
for($i = 0;$i<count($rows);$i++){
    echo $rows[$i][2];
}